package com.haochang.chunkvod.controller.activity.welcome;

import com.haochang.base.BaseActivity;
import com.haochang.chunkvod.R;
import com.haochang.chunkvod.app.common.user.UserToken;
import com.haochang.chunkvod.app.utils.VodDialog;
import com.haochang.chunkvod.controller.activity.VodActivity;
import com.haochang.chunkvod.controller.activity.login.LoginActivity;

import android.os.Bundle;
import android.os.Handler;

/**
 * @author qintao
 *         created at 2016/5/31 19:01
 *         vod应用主入口
 */

public class WelcomeActivity extends BaseActivity
{

	@Override
	protected void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);
	}

	@Override
	public void receiveParam()
	{
	}

	@Override
	public void initData()
	{
	}

	@Override
	public void initViews()
	{
		setContentView(R.layout.activity_welcome);
		new Handler().postDelayed(new Runnable()
		{

			@Override
			public void run()
			{
				startActivityOfMan();
			}
		}, 1500);
	}

	private void startActivityOfMan()
	{
		//TODO当没有登录的时候进入登录页，否则进入首页
		//		DataBaseExportUtil.copy();
		VodDialog.closeDialog();
		if (!UserToken.isTokenExist())
		{
			startEnterActivity(LoginActivity.class);
		} else
		{
			startEnterActivity(VodActivity.class);
		}
		this.finish();
	}

	@Override
	protected void onDestroy()
	{
		super.onDestroy();
		//强制 GC 回收效果更好.
		System.gc();
	}
}
